package com.module.retrofit.exception;


import io.reactivex.Observable;
import io.reactivex.ObservableSource;
import io.reactivex.functions.Function;


/**
 * 拦截onError()
 */
public class ExceptionConvert<E> implements Function<Throwable, ObservableSource<? extends E>> {
    @Override
    public ObservableSource<? extends E> apply(Throwable throwable) throws Exception {
        //拦截onError()并封装异常提示语
        return Observable.error(ExceptionHandler.handle(throwable));
    }
}
